<template>
  <el-main>
    <el-col class="search-form">
      <el-form :inline="true" :model="formInline" size="mini">
        <el-form-item label="金额:">
          <el-input class="ipt-width-150" v-model="formInline.user" placeholder="输入日期"></el-input>
        </el-form-item>
        <el-form-item label="联系人:">
          <el-input class="ipt-width-150" v-model="formInline.user1" placeholder="输入申请人"></el-input>
        </el-form-item>
        <el-form-item label="审批部门:">
          <el-input class="ipt-width-150" v-model="formInline.user2" placeholder="输入创建人"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">查询</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">重置</el-button>
        </el-form-item>
      </el-form>
    </el-col>

    <el-col class="biaoDa">
      <el-button type="primary" @click="dialogFormVisible = true" class="text-rigth">添加</el-button>
      <el-table :data="textData" class="table" border style="width: 100%">
        <el-table-column fixed prop="id" label="审批部门" width="100"></el-table-column>
        <el-table-column prop="name" label="申请标题" width="150"></el-table-column>
        <el-table-column prop="sex" label="申请详细" width="200"></el-table-column>
        <el-table-column prop="clas" label="金额" width="100"></el-table-column>
        <el-table-column prop="number" label="供应商" width="120"></el-table-column>
        <el-table-column prop="idCard" label="联系人" width="100"></el-table-column>
        <el-table-column prop="add" label="发票" width="150"></el-table-column>
        <el-table-column prop="date" label="图片" width="230"></el-table-column>
        <el-table-column prop="date1" label="附件" width="180"></el-table-column>
        <el-table-column prop="shen" label="审批人" width="100"></el-table-column>
        <el-table-column fixed="right" label="操作" width="125">
          <template slot-scope="scope">
            <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
            <el-button @click="handleClick(scope.row)" type="text" size="small">更改</el-button>
            <el-button @click="handleClick(scope.row)" type="text" size="small">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-col>

    <el-col class="block">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage4"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="100"
        layout="total, sizes, prev, pager, next, jumper"
        :total="40"
      ></el-pagination>
    </el-col>

    <el-dialog title="添加付款申请" :visible.sync="dialogFormVisible" class="metaik">
      <el-form :model="form" class="me-text">
        <el-form-item label="审批部门" class="me-nai1">
          <el-input v-model="form.addName" class="me-input"></el-input>
        </el-form-item>
        <el-form-item label="申请标题" class="me-nai1">
          <el-input v-model="form.addSex" class="me-input"></el-input>
        </el-form-item>
        <el-form-item label="审批详细" class="me-nai1">
          <el-input v-model="form.addClass" class="me-input"></el-input>
        </el-form-item>
        <el-form-item label="金额" class="me-nai1">
          <el-input v-model="form.addNumber" class="me-input"></el-input>
        </el-form-item>
        <el-form-item label="供应商" class="me-nai1">
          <el-input v-model="form.addIdcard" class="me-input"></el-input>
        </el-form-item>
        <el-form-item label="联系人" class="me-nai1">
          <el-input v-model="form.addAdd" class="me-input"></el-input>
        </el-form-item>
        <el-form-item label="发票" class="me-nai1">
          <el-input v-model="form.addDate" class="me-input"></el-input>
        </el-form-item>
        <el-form-item label="附件" class="me-nai1">
          <el-input v-model="form.addDate" class="me-input"></el-input>
        </el-form-item>
        <el-form-item label="审批人" class="me-nai1">
          <el-input v-model="form.addDate" class="me-input"></el-input>
        </el-form-item>
        <el-form-item label="抄送人" class="me-nai1">
          <el-input v-model="form.addDate" class="me-input"></el-input>
        </el-form-item>
        <el-form-item label="图片" class="me-tu">
          <!-- <el-input v-model="addDate"></el-input> -->
          <el-upload action="#" list-type="picture-card" :auto-upload="false">
            <i slot="default" class="el-icon-plus"></i>
            <div slot="file" slot-scope="{file}">
              <img class="el-upload-list__item-thumbnail" :src="file.url" alt />
              <span class="el-upload-list__item-actions">
                <span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
                  <i class="el-icon-zoom-in"></i>
                </span>
                <span
                  v-if="!disabled"
                  class="el-upload-list__item-delete"
                  @click="handleDownload(file)"
                >
                  <i class="el-icon-download"></i>
                </span>
                <span
                  v-if="!disabled"
                  class="el-upload-list__item-delete"
                  @click="handleRemove(file)"
                >
                  <i class="el-icon-delete"></i>
                </span>
              </span>
            </div>
          </el-upload>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
      </div>
    </el-dialog>

    <!-- 查看模态框 -->
    <el-dialog class="fade" :visible.sync="dialogTableVisible">
      <div class="check">
        <el-table :data="textData">
          <!-- <el-table-column  prop="checkid" label="编号" width="120"></el-table-column> -->
          <el-table-column label="审批部门" prop="checkname" width="120"></el-table-column>
          <el-table-column label="申请标题" prop="checksex" width="100"></el-table-column>
          <el-table-column label="申请详细" prop="checknumber" width="120"></el-table-column>
          <!-- <el-table-column label="电话详细" prop="checkidCard" width="200"></el-table-column> -->
          <el-table-column label="金额" prop="checkadd" width="180"></el-table-column>
          <el-table-column label="供应商" prop="checkdepartme" width="120"></el-table-column>
          <el-table-column label="联系人" prop="checkdepartment" width="120"></el-table-column>
          <el-table-column label="发票" prop="checkdepar" width="120"></el-table-column>
          <el-table-column label="图片" prop="chetu" width="120"></el-table-column>
          <el-table-column label="附件" prop="chefjian" width="120"></el-table-column>
          <el-table-column label="审批人" prop="chespr" width="120"></el-table-column>
        </el-table>
      </div>
    </el-dialog>
  </el-main>
</template>

<script>
export default {
  name: "expenses",
  data() {
    return {
      textData: [
        {
          id: "224",
          name: "没钱了",
          sex: "没钱了拿点钱来用",
          clas: "100000",
          number: "阿里巴巴",
          idCard: "无名之辈",
          add: "无",
          date: "无",
          date1: "无。。。。",
          shen: "我弟弟",
        },
        {
          id: "224",
          name: "没钱了",
          sex: "没钱了拿点钱来用",
          clas: "100000",
          number: "阿里巴巴",
          idCard: "无名之辈",
          add: "无",
          date: "无",
          date1: "无。。。。",
          shen: "我弟弟",
        },
        {
          id: "223",
          name: "没钱了",
          sex: "没钱了拿点钱来用",
          clas: "100000",
          number: "阿里巴巴",
          idCard: "无名之辈",
          add: "无",
          date: "无",
          date1: "无。。。。",
          shen: "我弟弟",
        },
        {
          id: "221",
          name: "没钱了",
          sex: "没钱了拿点钱来用",
          clas: "100000",
          number: "阿里巴巴",
          idCard: "无名之辈",
          add: "无",
          date: "无",
          date1: "无。。。。",
          shen: "我弟弟",
        },
      ],

      // 搜索框
      formInline: {
        user: "",
        user1: "",
        user2: "",
      },

      dialogTableVisible: false,
      dialogFormVisible: false,
      // <!-- 添加信息模态框 -->
      form: {
        name: "",
        region: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: "",
      },
      formLabelWidth: "120px",
      dialogImageUrl: "",
      dialogVisible: false,
      disabled: false,
      // 翻页
      currentPage4: 1,
    };
  },
  methods: {
    // 模态框查看
    handleClick(row) {
      this.dialogTableVisible = true;
      this.textData[0].checkname = row.id;
      this.textData[0].checksex = row.name;
      this.textData[0].checknumber = row.sex;
      this.textData[0].checkadd = row.clas;
      this.textData[0].checkdepartme = row.number;
      this.textData[0].checkdepartment = row.idCard;
      this.textData[0].checkdepar = row.add;
      this.textData[0].chetu = row.date;
      this.textData[0].chefjian = row.date1;
      this.textData[0].chespr = row.shen;
    },
    // 搜索框搜索按
    onSubmit() {
      console.log("submit!");
    },
    // 模态框图片
    handleRemove(file) {
      console.log(file);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    handleDownload(file) {
      console.log(file);
    },
    // 翻页
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
  },
};
</script>

<style scoped lang="less">
.search-form {
  height: 60px;
  padding-top: 15px;
  margin-bottom: 20px;
  padding-left: 20px;
  box-shadow: 0 0 3px 1px #e4e4e4;
  font-size: 25px;
}
.text-rigth {
  margin-top: 10px;
  margin-bottom: 15px;
}
.biaoDa {
  margin-bottom: 10px;
  padding-left: 20px;
  padding-bottom: 20px;
  padding-right: 20px;
  box-shadow: 0 0px 3px 1px #e4e4e4;
}
.block {
  height: 50px;
  text-align: center;
  padding-top: 15px;
  box-shadow: 0 0px 3px 1px #e4e4e4;
}
.me-text {
  width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}
.me-nai1 {
  width: 50%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: stretch;
  margin-bottom: 5px;
}
.me-input {
  widows: 100px;
}
.me-tu {
  width: 100%;
  display: flex;
  flex-direction: row;
}
</style>